package com.bjpowernode.util;

/**
 * Created whit IntelliJ IDEA.
 * Description：
 * User：ZHONGCHEN
 * Date:2022-10-28
 * Time:13:56
 */

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * 日志工具类
 */
public class LogUtils {
    public static void info(String msg,Object... o){
        print(msg," -info- ",o);
    }
    public static void error(String msg,Object... o){
        print(msg," -error- ",o);
    }
    private static void print(String msg, String level, Object... o) {
        if (o != null && o.length > 0) {
            msg = String.format(msg.replace("{}", "%s"), o);
        }
        String name = Thread.currentThread().getName();
        System.out.println(LocalTime.now().format(DateTimeFormatter.ofPattern("hh:mm:ss")) + name + level + msg);
    }
}
